| Conditions | 3 |
| Total Lines | 22 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | export interface DisplayState { |
||
| 6 | |||
| 7 | export function calculateDisplayState(binaryValue: number): DisplayState { |
||
| 8 | if (binaryValue === 0) { |
||
| 9 | return { |
||
| 10 | indexText: '-', |
||
| 11 | announcement: 'No pattern selected', |
||
| 12 | shouldGetWord: false, |
||
| 13 | }; |
||
| 14 | } |
||
| 15 | |||
| 16 | if (binaryValue > 2048) { |
||
| 17 | return { |
||
| 18 | indexText: binaryValue.toString(), |
||
| 19 | announcement: `Value ${binaryValue} is out of range. Maximum is 2048`, |
||
| 20 | shouldGetWord: false, |
||
| 21 | }; |
||
| 22 | } |
||
| 23 | |||
| 24 | return { |
||
| 25 | indexText: binaryValue.toString(), |
||
| 26 | announcement: '', // Will be filled with word info |
||
| 27 | shouldGetWord: true, |
||
| 28 | }; |
||
| 52 |